<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<meta charset="utf-8">
<head th:include="include :: header"></head>

<style>
    .upload {
        position: relative;
    }

    .upImg {
        width: 100px;
        height: 100px;
    }

    .closeUpload {
        width: 20px;
        height: 20px;
        position: absolute;
        top: 0;
        right: 0;
    }

    .myupdataList {
        display: flex;
        align-items: center;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .mybutton {
        background: #fff;
        height: 200px;
        width: 150px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        color: #a9b7b7;
        border: 2px solid #a9b7b7;
        margin-right: 10px;
        padding: 10px;
    }

    .mybutton:hover {
        cursor: pointer;
    }
    .layui-form-label {
        width: 115px !important;
    }
    .layui-input-block{
        display: flex;    width: calc(100% - 115px);
    }
    #contractState,#mySelect1,#mySelect2,.layui-form-select{
        width: 100%;
    }
    .layui-input{
        color: #000!important;
    }
</style>

<body>

<input type="hidden" th:value="${type}" id="type" />
<input type="hidden" th:value="${myData}" id="myData" />
<input type="hidden" th:value="${pdfList}" id="pdfList" />
<input type="hidden" th:value="${pdfListYi}" id="pdfListYi" />
<input type="hidden" th:value="${oldpdfList}" id="oldpdfList" />
<input type="hidden" th:value="${oldpdfListYi}" id="oldpdfListYi" />
<input type="hidden" th:value="${myData?.projectId}" id="projectId" />
<input type="hidden" th:value="${myData?.contractType}" id="contractType" />
<input type="hidden" th:value="${myData?.id}" id="orderId" />
<input type="hidden" id="nameJia" />
<input type="hidden" id="nameYi" />
<input type="hidden" id="identityCardYi" />
<div class="layui-fluid mt2">
    <form class="layui-form">

        <div class="layui-form-item" style="display: flex;">
            <div class="layui-form-item" style="width: 50%">
                <label class="layui-form-label">用户合同</label>
                <div class="layui-input-block">
                    <div class="layui-form-item myupdataList  " id="myUpdataDiv">
                        <button type="button" class="mybutton" id="contract" th:if="${type=='add'||type=='edit'}">
                            <i class="layui-icon" style="font-size: 70px;color: #a9b7b7;">&#xe67c;</i>请上传本地合同文件
                            <span>支持PDF</span>
                        </button>
                    </div>

                </div>
                <input type="hidden" name="contractNamePath" lay-verify="contractNamePath" autocomplete="off" placeholder="请输入"
                       class="layui-input">

            </div>
            <div class="layui-form-item" style="width: 50%">
                <label class="layui-form-label">阿姨合同</label>
                <div class="layui-input-block">
                    <div class="layui-form-item myupdataList  " id="myUpdataDivYi">
                        <button type="button" class="mybutton" id="contractYi" th:if="${type=='add'||type=='edit'}">
                            <i class="layui-icon" style="font-size: 70px;color: #a9b7b7;">&#xe67c;</i>请上传本地合同文件
                            <span>支持PDF</span>
                        </button>
                    </div>

                </div>
                <input type="hidden" name="contractNameYiPath" lay-verify="contractNameYiPath" autocomplete="off" placeholder="请输入"
                       class="layui-input">

            </div>

        </div>

        <div class="layui-form-item" th:if="${type=='info'||type=='edit'}" style="display: flex;">
            <div class="layui-form-item" style="width: 50%">
                <label class="layui-form-label">用户历史合同</label>
                <div class="layui-input-block">
                    <div class="layui-form-item myupdataList  " id="myOldUpdataDiv">
                    </div>

                </div>
            </div>
            <div class="layui-form-item" style="width: 50%">
                <label class="layui-form-label">阿姨历史合同</label>
                <div class="layui-input-block">
                    <div class="layui-form-item myupdataList  " id="myOldUpdataDivYi">
                    </div>

                </div>

            </div>

        </div>

        <div class="layui-form-item">
            <div class="layui-inline" style="width: calc((100% - 40px) / 3);">
                <label class="layui-form-label required">发起方</label>
                <div class="layui-input-block">
                    <select  id="mySelect1" lay-search=""   th:disabled="${type=='info'||type=='edit'}"  name="initiateId" lay-verify="required"  lay-filter="mySelect1-filter">
                        <option value="">请等待数据加载</option>
                        <option th:if="${type == 'info'||type == 'edit'}" th:value="${myData?.id}" th:text="${myData?.nameJia}" selected></option>
                    </select>
                </div>
            </div>
            <div class="layui-inline" style="width: calc((100% - 40px) / 3);">
				<label class="layui-form-label required">联系方式</label>
				<div class="layui-input-block">
					<input type="text" name="phoneJia" lay-verify="required" autocomplete="off"
						   placeholder="请先选择发起方"
                           disabled
                           id="phoneJia"
                           th:value="${myData?.phoneJia}"
						   class="layui-input">
				</div>

            </div>
            <div class="layui-inline" style="width: calc((100% - 40px) / 3);">
                <label class="layui-form-label required">家庭住址</label>
                <div class="layui-input-block">
					<input type="text" name="homeAddressJia" lay-verify="required" autocomplete="off"
						   placeholder="请输入家庭住址"
                           id="homeAddressJia"
                           th:disabled="${type!='add'}"
                           th:value="${myData?.homeAddressJia}"
						   class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline" style="width: calc((100% - 40px) / 3);">
                <label class="layui-form-label">合同类型</label>
                <div class="layui-input-block">
					<div id="contractState"></div>
                </div>
            </div>
            <div class="layui-inline" style="width: calc((100% - 40px) / 3);">
				<label class="layui-form-label required">服务开始时间</label>
				<div class="layui-input-block">
					<input name="startTime" class="form-control startTime" id="startTime" type="text"
						   lay-verify="required"
                           th:disabled="${type=='info'}"
                           th:value="${myData?.startTime}  eq null ? '' : ${#dates.format(myData?.startTime, 'yyyy-MM-dd')}"
						   placeholder="请输入服务开始时间">
				</div>

            </div>
            <div class="layui-inline" style="width: calc((100% - 40px) / 3);">
                <label class="layui-form-label required">服务结束时间</label>
                <div class="layui-input-block">
                    <input name="endTime" class="form-control endTime" id="endTime" type="text"
                           lay-verify="required"
                           th:disabled="${type=='info'}"
                           th:value="${myData?.endTime}  eq null ? '' : ${#dates.format(myData?.endTime, 'yyyy-MM-dd')}"
                           placeholder="请输入服务结束时间">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline" style="width: calc((100% - 40px) / 3);">
                <label class="layui-form-label required">发起方身份证</label>
                <div class="layui-input-block">
                    <input type="text" name="identityCardJia" lay-verify="required" autocomplete="off"
                           placeholder="请输入发起方身份证号"
                           th:disabled="${type=='info'||type=='edit'}"
                           th:value="${myData?.identityCardJia}"
                           class="layui-input">
                </div>
            </div>
            <div class="layui-inline" style="width: calc((100% - 40px) / 3);">
                <label class="layui-form-label required">服务地址</label>
                <div class="layui-input-block">
                    <input type="text" name="address" lay-verify="required" autocomplete="off"
                           placeholder="请输入服务地址"
                           id="address"
                           th:disabled="${type=='info'||type=='edit'}"
                           th:value="${myData?.address}" 
                           class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline" style="width: calc((100% - 40px) / 3);">
                <label class="layui-form-label">签约方</label>
                <div class="layui-input-block">
                    <select  id="mySelect2" lay-search="" disabled  name="signingId" lay-filter="mySelect2-filter">
                        <option value="">请先选择发起方</option>
                        <option th:if="${type == 'info'||type=='edit'}" th:value="${myData?.signingId}" th:text="${myData?.nameYi}" selected></option>
                    </select>
                </div>
            </div>
            <div class="layui-inline" style="width: calc((100% - 40px) / 3);">
				<label class="layui-form-label required">联系方式</label>
				<div class="layui-input-block">
					<input type="text" name="phoneYi" lay-verify="required" autocomplete="off"
						   placeholder="请先选择发起方"
                           disabled
                           id="phoneYi"
                           th:value="${myData?.phoneYi}"
						   class="layui-input">
				</div>

            </div>
            <div class="layui-inline" style="width: calc((100% - 40px) / 3);">
                <label class="layui-form-label required">家庭住址</label>
                <div class="layui-input-block">
					<input type="text" name="homeAddressYi" lay-verify="required" autocomplete="off"
						   placeholder="请先选择发起方"
                           disabled
                           id="homeAddressYi"
                           th:value="${myData?.homeAddressYi}"
						   class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline" style="width: calc((100% - 40px) / 3);">
                <label class="layui-form-label required">服务总价</label>
                <div class="layui-input-block">
                    <input type="text" name="totalPrice" lay-verify="required" autocomplete="off"
                           placeholder="请输入服务总价"
                           th:disabled="${type=='info'||type=='edit'}"
                           th:value="${myData?.totalPrice}"
                           onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')"
                           class="layui-input">
                </div>
            </div>
<!--            <div class="layui-inline" style="width: calc((100% - 40px) / 3);">-->
<!--				<label class="layui-form-label required">合同版本</label>-->
<!--				<div class="layui-input-block">-->
<!--					<input type="text" name="version" lay-verify="required" autocomplete="off"-->
<!--						   placeholder="请输入合同版本"-->
<!--                           th:disabled="${type=='info'}"-->
<!--                           th:value="${myData?.version}"-->
<!--                           onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')"-->
<!--						   class="layui-input">-->
<!--				</div>-->

<!--            </div>-->

        </div>


        <div class="layui-form-item  layui-flow-more">
            <div class="layui-inline">
                <button type="submit" class="layui-btn" lay-submit lay-filter="submit" th:text="${type=='add'?'立即提交':'确定'}"></button>
            </div>
        </div>

    </form>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript" src="/js/xmSelect.js"></script>
<script type="text/javascript" src="/js/webJs/jzweb/jazSysContract/add.js"></script>

</body>
</html>
